package com.running.base.run.jms.receiver;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

/**
 * A simple MDB to receive messages to an internal list
 */
public class JmsReceiver implements MessageListener {

    private static final Logger logger = LoggerFactory.getLogger(JmsReceiver.class);


    public void onMessage(Message message) {
        try {
            logger.info("jms消费到消息：{}", ((TextMessage)message).getText());
        } catch (JMSException e) {
            throw new RuntimeException(e);
        }
    }

}